/**   
 * 项目名：五位一体化工安全信息平台
 * 日期：    2019-12-10 08:35:30  
 * Copyright (c) 2015- joysuch-版权所有     
 */

package com.joysuch.wwyt.bp.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.joysuch.wwyt.core.support.AutoSetCommonFieldListener;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.hibernate.annotations.Proxy;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLDeleteAll;
import org.hibernate.annotations.Where;
import org.hibernate.validator.constraints.Range;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.time.LocalTime;

import static javax.persistence.GenerationType.IDENTITY;

@EntityListeners({ AuditingEntityListener.class, AutoSetCommonFieldListener.class })
@Entity
@Table(name = "wwyt_bp_production_facility_type")
@SQLDelete(sql = "update wwyt_bp_production_facility_type set DELETE_FLAG = '1' where id= ?")
@SQLDeleteAll(sql = "update wwyt_bp_production_facility_type set DELETE_FLAG = '1' where id= ?")
@Where(clause = "DELETE_FLAG = '0'")
@Proxy(lazy = false)
public class BpProductionFacilityType implements java.io.Serializable {

    // columns START
    //
    private Long id;
    //
    private String name;
    //
    private Integer number;
    // 删除标记
    private String deleteFlag;
    // 租户ID
    private Long tenentId;
    // 组织机构代码
    private String orgCode;

    private Long parentId;

    //是否到期提醒 0 否 ; 1 是
    @Range(min = 0, max = 1)
    private Byte expireRemindOrNot;
    //到期提醒类型
    private String remindType;
    //提醒时间
    @JsonFormat(pattern = "HH:mm:ss", timezone = "GMT+8")
    private LocalTime remindTime;
    //提醒人和部门互斥
    //提醒人可以多个
    private String remindUserIdJson;
    //提醒部门
    private Long departId;
    //0 人员; 1 部门
    private Byte userDepartFlag;
    // columns END


    public Byte getExpireRemindOrNot() {
        return expireRemindOrNot;
    }

    public void setExpireRemindOrNot(Byte expireRemindOrNot) {
        this.expireRemindOrNot = expireRemindOrNot;
    }

    public String getRemindType() {
        return remindType;
    }

    public void setRemindType(String remindType) {
        this.remindType = remindType;
    }

    public LocalTime getRemindTime() {
        return remindTime;
    }

    public void setRemindTime(LocalTime remindTime) {
        this.remindTime = remindTime;
    }

    public String getRemindUserIdJson() {
        return remindUserIdJson;
    }

    public void setRemindUserIdJson(String remindUserIdJson) {
        this.remindUserIdJson = remindUserIdJson;
    }

    public Long getDepartId() {
        return departId;
    }

    public void setDepartId(Long departId) {
        this.departId = departId;
    }

    public Byte getUserDepartFlag() {
        return userDepartFlag;
    }

    public void setUserDepartFlag(Byte userDepartFlag) {
        this.userDepartFlag = userDepartFlag;
    }

    public void setId(Long value) {
        this.id = value;
    }

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "Id", unique = true, nullable = false)
    public Long getId() {
        return this.id;
    }

    @Column(name = "NAME", length = 64)
    public String getName() {
        return this.name;
    }

    public void setName(String value) {
        this.name = value;
    }

    @Column(name = "NUMBER")
    public Integer getNumber() {
        return this.number;
    }

    public void setNumber(Integer value) {
        this.number = value;
    }

    @Column(name = "DELETE_FLAG", length = 2)
    public String getDeleteFlag() {
        return this.deleteFlag;
    }

    public void setDeleteFlag(String value) {
        this.deleteFlag = value;
    }

    @Column(name = "TENENT_ID")
    public Long getTenentId() {
        return this.tenentId;
    }

    public void setTenentId(Long value) {
        this.tenentId = value;
    }

    @Column(name = "ORG_CODE", length = 100)
    public String getOrgCode() {
        return this.orgCode;
    }

    public void setOrgCode(String value) {
        this.orgCode = value;
    }

    @Column(name = "PARENT_ID")
    public Long getParentId() {
        return parentId;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("name", getName())
                .append("number", getNumber())
                .append("deleteFlag", getDeleteFlag())
                .append("tenentId", getTenentId())
                .append("orgCode", getOrgCode())
                .toString();
    }

    public int hashCode() {
        return new HashCodeBuilder()
                .append(getId())
                .toHashCode();
    }

    public boolean equals(Object obj) {
        if (obj instanceof BpProductionFacilityType == false)
            return false;
        if (this == obj)
            return true;
        BpProductionFacilityType other = (BpProductionFacilityType) obj;
        return new EqualsBuilder()
                .append(getId(), other.getId())
                .isEquals();
    }
}
